// element-ui模块，第三方渲染模块

// 加载 Vue 组件库
import Vue from "vue";

// 引入弹框提示组件 Message 需要全局引用 使用 Vue.prototype
import { Button, Form, FormItem, Input, Message, Container, Header, Aside, Main, Menu, Submenu, MenuItem, Breadcrumb, BreadcrumbItem, Card, Row, Col, Table, TableColumn, Switch, Tooltip, Pagination, Dialog, MessageBox, Tag, Tree, Select, Option, Cascader, Alert, Tabs, TabPane, Steps, Step, CheckboxGroup, Checkbox, Upload, Timeline, TimelineItem } from "element-ui";
// 引入element-ui模块样式
import "element-ui/lib/theme-chalk/index.css";
Vue.use(Button);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Container);
Vue.use(Input);
Vue.use(Header);
Vue.use(Aside);
Vue.use(Main);
Vue.use(Menu);
Vue.use(MenuItem);
Vue.use(Submenu);
Vue.use(Breadcrumb);
Vue.use(BreadcrumbItem);
Vue.use(Card);
Vue.use(Row);
Vue.use(Col);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Switch);
Vue.use(Tooltip);
Vue.use(Pagination);
Vue.use(Dialog);
Vue.use(Tag);
Vue.use(Tree);
Vue.use(Select);
Vue.use(Option);
Vue.use(Cascader);
Vue.use(Alert);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Steps);
Vue.use(Step);
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
Vue.use(Upload);
Vue.use(Timeline);
Vue.use(TimelineItem);
// 全局注册 MessageBox
Vue.prototype.$message = Message;
// 全局注册 MessageBox
Vue.prototype.$confirm = MessageBox.confirm;

// 加载 treetable 组件
import TreeTable from "vue-table-with-tree-grid";
// 注册 treetable 组件(全局注册)
Vue.component("tree-table", TreeTable);

// 注册全局时间组件,将来毫秒渲染成年月日
Vue.filter("dataFormat", function (originVal) {
  const dt = new Date(originVal);

  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0");
  const d = (dt.getDate() + "").padStart(2, "0");

  const hh = (dt.getHours() + "").padStart(2, "0");
  const mm = (dt.getMinutes() + "").padStart(2, "0");
  const ss = (dt.getSeconds() + "").padStart(2, "0");
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});

// 加载vue-quill-editor组件;富文本编辑器组件
import VueQuillEditor from "vue-quill-editor";
import "quill/dist/quill.core.css"; // import styles 样式
import "quill/dist/quill.snow.css"; // for snow theme
import "quill/dist/quill.bubble.css"; // for bubble theme
// 全局注册富文本组件
Vue.use(VueQuillEditor /* { default global options } */);
